package com.jy.api.service.impl;

import com.jy.api.dao.LeaseProductDao;
import com.jy.api.domain.LeaseProduct;
import com.jy.api.service.LeaseProductService;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LeaseProductServiceImpl implements LeaseProductService {
    @Resource
    private LeaseProductDao leaseProductDao;
    @Override
    public LeaseProduct findOne(Integer id) {
        return leaseProductDao.findOne(id);
    }

    @Override
    public void save(LeaseProduct product) {
        leaseProductDao.saveAndFlush(product);
    }

    @Override
    public void delete(Integer id) {
        leaseProductDao.delete(id);
    }

    @Override
    public List<LeaseProduct> findByStoreIdOrderByQueueDesc(String storeId) {
        return leaseProductDao.findByStoreIdOrderByQueueDesc(storeId);
    }

    @Override
    public List<LeaseProduct> findByStoreIdOrderByProductTypeIdDesc(String storeId) {
        return leaseProductDao.findByStoreIdOrderByProductTypeIdDesc(storeId);
    }

    @Override
    public List<LeaseProduct> findAll(Specification<LeaseProduct> spec) {
        return leaseProductDao.findAll(spec);
    }
}
